<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>{:config('APP_NAME')}管理后台</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="/static/css/login.css" />
</head>
<body class="login-body">

<div class="login-box">
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <h3>{:config('APP_NAME')}管理后台&nbsp;<span class="version">{:config('APP_VERSION')}</span></h3>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">账号：</label>
            <div class="layui-input-inline">
                <input type="text" name="name" required class="layui-input" lay-verify="name" placeholder="请输入管理员账号"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码：</label>
            <div class="layui-input-inline">
                <input type="password" name="password" required class="layui-input" lay-verify="password" placeholder="请输入密码"/>
            </div>
        </div>

        <div class="layui-form-item">
            <button type="button" class="layui-btn btn-submit" lay-submit="" lay-filter="sub">立即登录</button>
        </div>
    </form>
</div>
<script src="/static/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script src="/static/js/gt.js"></script>
<script src="/static/js/common.js"></script>
<script type="text/javascript">
    layui.use(['form', 'layer'], function () {
        var $ = layui.jquery,form = layui.form(),layer = layui.layer;

        // 登录表单验证
        form.verify({
            name: function (value) {
                if (value == "") {
                    return "请输入管理员账号";
                }
            },
            password: function (value) {
                if (value == "") {
                    return "请输入密码";
                }
            }
        });

        form.on('submit(sub)', function (data) {
            var params  = {
                url : "{:url('admin/Login/login')}",
                data: data.field,
                type: 'post',
                sCallback:function(res){
                    layer.msg(res.msg,{time:1800},function(){
                        location.href = "{:url('/admin')}";
                    });
                }
            }
            common.request(params);
            return false;
        })
    })

</script>

</body>
</html>